define([ 'backbone',
        'components/pop/base',
        'text!components/pop/templates/change.html',
        'core/utils'],
    function( Backbone, Base, template, utils) {
        return Base.extend({
            template: _.template(template),
            className: 'popover right popover-change',
            events: {
                'click .js-btn-cancel': 'hide',
                'click .js-btn-confirm': 'triggerCallback'
            },
            initialize: function(options) {
                Base.prototype.initialize.call(this, options);
            },
            render: function() {
                var that = this;
                this.$el.html(this.template({}));
                return this;
            },
            setData: function(data) {
                this.data = data;
                this.render();
            },
            reset: function(obj) {
                var callback = obj.callback,
                    target = obj.target,
                    trigger = obj.trigger,
                    data = obj.data;

                this.setCallback(callback);
                this.setTarget(target);
                this.setTrigger(trigger);
                this.setData(data);
                this.positioning();
                this.show();
            },
            triggerCallback: function() {
                this.callback({join: $.trim(this.$('[name="discount"]:checked').val())});
                this.hide();
            }
        });
    });
